#include "thread.h"

int get_grandpaID(sharInfo_t * sharInfo,MYSQL * mysql){
    int parID=sharInfo->parentID;
    char order[1024];
    bzero(order,sizeof(order));

    sprintf(order,"select parID from df_mes where ID = %d;",parID);

    int qret=mysql_query(mysql,order);
    if(qret != 0){
        fprintf(stderr,"mysql_query:%s\n", mysql_error(mysql));
        return -1;
    }
    MYSQL_RES * result= mysql_store_result(mysql);

    MYSQL_ROW row=mysql_fetch_row(result);
    sharInfo->parentID=atoi(row[0]);

    mysql_free_result(result);
    return 0;

}
